﻿using RMS.Manage.Web.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace RMS.Manage.Web.Areas.Demo.Controllers
{
    public class ChartsController : BaseController
    {
        /// <summary>
        /// Flot图标控件
        /// </summary>
        /// <returns></returns>
        public ActionResult FlotCharts()
        {
            return View();
        }
        /// <summary>
        /// Morris图标控件
        /// </summary>
        /// <returns></returns>
        public ActionResult MorrisCharts()
        {
            return View();
        }
        /// <summary>
        /// Morris图标控件获取数据
        /// </summary>
        /// <param name="type">表格类型</param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult MorrisCharts(string type)
        {
            List<ChartData> data = new List<ChartData>();
            switch (type)
            {
                case "bar":
                    data = new List<ChartData>();
                    data.Add(new ChartData() { y = "2007", a = "75", b = "65" });
                    data.Add(new ChartData() { y = "2008", a = "50", b = "40" });
                    data.Add(new ChartData() { y = "2009", a = "75", b = "65" });
                    data.Add(new ChartData() { y = "2010", a = "50", b = "40" });
                    data.Add(new ChartData() { y = "2011", a = "75", b = "65" });
                    data.Add(new ChartData() { y = "2012", a = "100", b = "90" });
                    break;
                default:
                    break;
            }
            return Json(data);
        }

	}
    class ChartData
    {
        public string y { get; set; }
        public string a { get; set; }
        public string b { get; set; }
    }
}